home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source1.lha / source / amiga / HardBlocks.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  11.3 KB  |  259 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: HardBlocks.mod $
  4.   Description: File system identifier blocks for hard disks
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 02:39:55 $
  10.  
  11.   $VER: hardblocks.h 36.3 (23.8.91)
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  24.  
  25. MODULE [2] HardBlocks;
  26.  
  27. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  28. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  29.  
  30. IMPORT e := Exec;
  31.  
  32.  
  33. (*
  34. **      File System identifier blocks for hard disks
  35. *)
  36.  
  37.  
  38. (* --------------------------------------------------------------------
  39.  *
  40.  *      This file describes blocks of data that exist on a hard disk
  41.  *      to describe that disk.  They are not generically accessable to
  42.  *      the user as they do not appear on any DOS drive.  The blocks
  43.  *      are tagged with a unique identifier, checksummed, and linked
  44.  *      together.  The root of these blocks is the RigidDiskBlock.
  45.  *
  46.  *      The RigidDiskBlock must exist on the disk within the first
  47.  *      rdbLocationLIMIT blocks.  This inhibits the use of the zero
  48.  *      cylinder in an AmigaDOS partition: although it is strictly
  49.  *      possible to store the RigidDiskBlock data in the reserved
  50.  *      area of a partition, this practice is discouraged since the
  51.  *      reserved blocks of a partition are overwritten by "Format",
  52.  *      "Install", "DiskCopy", etc.  The recommended disk layout,
  53.  *      then, is to use the first cylinder(s) to store all the drive
  54.  *      data specified by these blocks: i.e. partition descriptions,
  55.  *      file system load images, drive bad block maps, spare blocks,
  56.  *      etc.
  57.  *
  58.  *      Though only 512 byte blocks are currently supported by the
  59.  *      file system, this proposal tries to be forward-looking by
  60.  *      making the block size explicit, and by using only the first
  61.  *      256 bytes for all blocks but the LoadSeg data.
  62.  *
  63.  *------------------------------------------------------------------*)
  64.  
  65. (*
  66.  *  NOTE
  67.  *      optional block addresses below contain $ffffffff to indicate
  68.  *      a NULL address, as zero is a valid address
  69.  *)
  70.  
  71. TYPE
  72.  
  73.   RigidDiskBlockPtr * = POINTER TO RigidDiskBlock;
  74.   RigidDiskBlock * = RECORD
  75.     id *                : e.ULONG; (* 4 character identifier *)
  76.     summedLongs *       : e.ULONG; (* size of this checksummed structure *)
  77.     chkSum *            : LONGINT; (* block checksum (longword sum to zero) *)
  78.     hostID *            : e.ULONG; (* SCSI Target ID of host *)
  79.     blockBytes *        : e.ULONG; (* size of disk blocks *)
  80.     flags *             : e.ULONG; (* see below for defines *)
  81.     (* block list heads *)
  82.     badBlockList *      : e.ULONG; (* optional bad block list *)
  83.     partitionList *     : e.ULONG; (* optional first partition block *)
  84.     fileSysHeaderList * : e.ULONG; (* optional file system header block *)
  85.     driveInit *         : e.ULONG; (* optional drive-specific init code *)
  86.                                       (* DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 *)
  87.     reserved1 *         : ARRAY 6 OF e.ULONG;
  88.                                       (* set to $ffffffff *)
  89.     (* physical drive characteristics *)
  90.     cylinders *         : e.ULONG; (* number of drive cylinders *)
  91.     sectors *           : e.ULONG; (* sectors per track *)
  92.     heads *             : e.ULONG; (* number of drive heads *)
  93.     interleave *        : e.ULONG; (* interleave *)
  94.     park *              : e.ULONG; (* landing zone cylinder *)
  95.     reserved2 *         : ARRAY 3 OF e.ULONG;
  96.     writePreComp *      : e.ULONG; (* starting cylinder: write precompensation *)
  97.     reducedWrite *      : e.ULONG; (* starting cylinder: reduced write current *)
  98.     stepRate *          : e.ULONG; (* drive step rate *)
  99.     reserved3 *         : ARRAY 5 OF e.ULONG;
  100.     (* logical drive characteristics *)
  101.     rdbBlocksLo *       : e.ULONG; (* low block of range reserved for hardblocks *)
  102.     rdbBlocksHi *       : e.ULONG; (* high block of range for these hardblocks *)
  103.     loCylinder *        : e.ULONG; (* low cylinder of partitionable disk area *)
  104.     hiCylinder *        : e.ULONG; (* high cylinder of partitionable data area *)
  105.     cylBlocks *         : e.ULONG; (* number of blocks available per cylinder *)
  106.     autoParkSeconds *   : e.ULONG; (* zero for no auto park *)
  107.     highRDSKBlock *     : e.ULONG; (* highest block used by RDSK *)
  108.                                       (* (not including replacement bad blocks) *)
  109.     reserved4 *         : e.ULONG;
  110.     (* drive identification *)
  111.     diskVendor *        : ARRAY 8 OF CHAR;
  112.     diskProduct *       : ARRAY 16 OF CHAR;
  113.     diskRevision *      : ARRAY 4 OF CHAR;
  114.     controllerVendor *  : ARRAY 8 OF CHAR;
  115.     controllerProduct * : ARRAY 16 OF CHAR;
  116.     controllerRevision * : ARRAY 4 OF CHAR;
  117.     reserved5 *         : ARRAY 10 OF e.ULONG;
  118.   END; (* RigidDiskBlock *)
  119.  
  120. CONST
  121.  
  122.   idNameRigidDisk        * = 5244534BH;      (* 'RDSK' *)
  123.  
  124.   locationLimit      * = 16;
  125.  
  126.   last      * = 0;        (* no disks exist to be configured after *)
  127.                           (*   this one on this controller *)
  128.   lastLun   * = 1;        (* no LUNs exist to be configured greater *)
  129.                           (*   than this one at this SCSI Target ID *)
  130.   lastTID   * = 2;        (* no Target IDs exist to be configured *)
  131.                           (*   greater than this one on this SCSI bus *)
  132.   lsatTID   * = lastTID;  (* typo *)
  133.   noReselect * = 3;       (* don't bother trying to perform reselection *)
  134.                           (*   when talking to this drive *)
  135.   diskID    * = 4;        (* rdbDisk... identification valid *)
  136.   ctrlrID   * = 5;        (* rdbController... identification valid *)
  137.  
  138.                           (* added 7/20/89 by commodore: *)
  139.   synch     * = 6;        (* drive supports scsi synchronous mode *)
  140.                           (* CAN BE DANGEROUS TO USE IF IT DOESN'T! *)
  141.  
  142. (* ------------------------------------------------------------------*)
  143.  
  144. TYPE
  145.  
  146.   BadBlockEntryPtr * = POINTER TO BadBlockEntry;
  147.   BadBlockEntry * = RECORD
  148.     badBlock *  : e.ULONG;      (* block number of bad block *)
  149.     goodBlock * : e.ULONG;      (* block number of replacement block *)
  150.   END; (* BadBlockEntry *)
  151.  
  152.   BadBlockBlockPtr * = POINTER TO BadBlockBlock;
  153.   BadBlockBlock * = RECORD
  154.     id *          : e.ULONG; (* 4 character identifier *)
  155.     summedLongs * : e.ULONG; (* size of this checksummed structure *)
  156.     chkSum *      : LONGINT; (* block checksum (longword sum to zero) *)
  157.     hostID *      : e.ULONG; (* SCSI Target ID of host *)
  158.     next *        : e.ULONG; (* block number of the next BadBlockBlock *)
  159.     reserved *    : e.ULONG;
  160.     blockPairs *  : ARRAY 61 OF BadBlockEntry;
  161.                                 (* bad block entry pairs *)
  162.     (* note [61] assumes 512 byte blocks *)
  163.   END; (* BadBlockBlock *)
  164.  
  165. CONST
  166.  
  167.   idNameBadBlock         * = 42414442H;      (* 'BADB' *)
  168.  
  169. (* ------------------------------------------------------------------*)
  170.  
  171. TYPE
  172.  
  173.   PartitionBlockPtr * = POINTER TO PartitionBlock;
  174.   PartitionBlock * = RECORD
  175.     id *          : e.ULONG;             (* 4 character identifier *)
  176.     summedLongs * : e.ULONG;             (* size of this checksummed structure *)
  177.     chkSum *      : LONGINT;             (* block checksum (longword sum to zero) *)
  178.     hostID *      : e.ULONG;             (* SCSI Target ID of host *)
  179.     next *        : e.ULONG;             (* block number of the next PartitionBlock *)
  180.     flags *       : e.ULONG;             (* see below for defines *)
  181.     reserved1 *   : ARRAY 2 OF e.ULONG;
  182.     devFlags *    : e.ULONG;             (* preferred flags for OpenDevice *)
  183.     driveName *   : ARRAY 32 OF CHAR;    (* preferred DOS device name: BSTR form *)
  184.                                            (* (not used if this name is in use) *)
  185.     reserved2 *   : ARRAY 15 OF e.ULONG; (* filler to 32 longwords *)
  186.     environment * : ARRAY 17 OF e.ULONG; (* environment vector for this partition *)
  187.     eReserved *   : ARRAY 15 OF e.ULONG; (* reserved for future environment vector *)
  188.   END; (* PartitionBlock *)
  189.  
  190. CONST
  191.  
  192.   idNamePartition        * = 50415254H;      (* 'PART' *)
  193.  
  194.   bootable   * = 0;        (* this partition is intended to be bootable *)
  195.                            (*   (expected directories and files exist) *)
  196.   noMount    * = 1;        (* do not mount this partition (e.g. manually *)
  197.                            (*   mounted, but space reserved here) *)
  198.  
  199. (* ------------------------------------------------------------------*)
  200.  
  201. TYPE
  202.  
  203.   FileSysHeaderBlockPtr * = POINTER TO FileSysHeaderBlock;
  204.   FileSysHeaderBlock * = RECORD
  205.     id *          : e.ULONG; (* 4 character identifier *)
  206.     summedLongs * : e.ULONG; (* size of this checksummed structure *)
  207.     chkSum *      : LONGINT; (* block checksum (longword sum to zero) *)
  208.     hostID *      : e.ULONG; (* SCSI Target ID of host *)
  209.     next *        : e.ULONG; (* block number of next FileSysHeaderBlock *)
  210.     flags *       : e.ULONG; (* see below for defines *)
  211.     reserved1 *   : ARRAY 2 OF e.ULONG;
  212.     dosType *     : e.ULONG; (* file system description: match this with *)
  213.                                 (* partition environment's deDOSTYPE entry *)
  214.     version *     : e.ULONG; (* release version of this code *)
  215.     patchFlags *  : e.ULONG; (* bits set for those of the following that *)
  216.                                 (*   need to be substituted into a standard *)
  217.                                 (*   device node for this file system: e.g. *)
  218.                                 (*   180H to substitute SegList & GlobalVec *)
  219.     type *        : e.ULONG; (* device node type: zero *)
  220.     task *        : e.ULONG; (* standard dos "task" field: zero *)
  221.     lock *        : e.ULONG; (* not used for devices: zero *)
  222.     handler *     : e.ULONG; (* filename to loadseg: zero placeholder *)
  223.     stackSize *   : e.ULONG; (* stacksize to use when starting task *)
  224.     priority *    : LONGINT; (* task priority when starting task *)
  225.     startup *     : LONGINT; (* startup msg: zero placeholder *)
  226.     segListBlocks * : LONGINT; (* first of linked list of LoadSegBlocks: *)
  227.                                   (*   note that this entry requires some *)
  228.                                   (*   processing before substitution *)
  229.     globalVec *   : LONGINT; (* BCPL global vector when starting task *)
  230.     reserved2 *   : ARRAY 23 OF e.ULONG; (* (those reserved by PatchFlags) *)
  231.     reserved3 *   : ARRAY 21 OF e.ULONG;
  232.   END; (* FileSysHeaderBlock *)
  233.  
  234. CONST
  235.  
  236.   idNameFileSysHeader    * = 46534844H;      (* 'FSHD' *)
  237.  
  238. (* ------------------------------------------------------------------*)
  239.  
  240. TYPE
  241.  
  242.   LoadSegBlockPtr * = POINTER TO LoadSegBlock;
  243.   LoadSegBlock * = RECORD
  244.     id *          : e.ULONG; (* 4 character identifier *)
  245.     summedLongs * : e.ULONG; (* size of this checksummed structure *)
  246.     chkSum *      : LONGINT; (* block checksum (longword sum to zero) *)
  247.     hostID *      : e.ULONG; (* Target ID of host *)
  248.     next *        : e.ULONG; (* block number of the next LoadSegBlock *)
  249.     loadData *    : ARRAY 123 OF e.ULONG;  (* data for "loadseg" *)
  250.     (* note [123] assumes 512 byte blocks *)
  251.   END; (* LoadSegBlock *)
  252.  
  253. CONST
  254.  
  255.   idNameLoadSeg          * = 4C534547H;      (* 'LSEG' *)
  256.  
  257.  
  258. END HardBlocks.
  259.